<?php

use yii\db\Schema;
use yii\db\Migration;

class m160308_062216_add_vam_audience_function extends Migration
{
    public function up()
    {
        $sql = <<<FINE
drop table if exists {{%audience_type}};
create table {{%audience_type}} (
  id int(10) unsigned not null auto_increment,
  ad_network_id int(10) not null default 1 comment '1 for vamaker, vam_ad_network table primary key',
  parent_id int(10) null comment '父级分类',
  title varchar(64) not null comment '人群标签名称',
  last_update timestamp not null default current_timestamp on update current_timestamp,
  primary key(id) 
)engine=innodb default charset=utf8;

insert into {{%audience_type}} (id, parent_id, title) values
(1, 0, '人群身份'),
(2, 1, '年龄'),
(3, 2, '<18'),
(4, 2, '18-24'),
(5, 2, '25-29'),
(6, 2, '30-34'),
(7, 2, '35+'),
(8, 1, '职业状态'),
(9, 8, '初入职场'),
(10, 8, '江湖老人'),
(11, 8, '基层领导'),
(12, 8, '中层领导'),
(13, 8, '高层领导'),
(14, 1, '职能'),
(15, 14, '学生'),
(16, 14, 'IT技术'),
(17, 14, '中小企业主或采购相关人员'),
(18, 14, '服务业劳动力'),
(19, 14, '工业劳动力'),
(20, 14, '其他'),
(21, 1, '所在行业'),
(22, 21, '计算机/互联网/通信电子'),
(23, 21, '金融/银行/保险'),
(24, 21, '贸易/消费'),
(25, 21, '制造'),
(26, 21, '制药医疗'),
(27, 21, '广告/媒体'),
(28, 21, '房地产/建筑'),
(29, 21, '教育培训'),
(30, 21, '专业服务'),
(31, 21, '服务业'),
(32, 21, '物流运输'),
(33, 21, '能源/原材料'),
(34, 21, '政府/非赢利机构'),
(35, 21, '农林牧渔'),
(36, 1, '婚姻状态'),
(37, 36, '未婚'),
(38, 36, '已婚'),
(39, 1, '人生阶段'),
(40, 39, '婚育'),
(41, 40, '征婚'),
(42, 40, '备婚'),
(43, 40, '孕期'),
(44, 39, '育儿'),
(45, 44, '0-3岁'),
(46, 44, '3-6岁'),
(47, 44, '小学'),
(48, 44, '初中'),
(49, 44, '高中'),
(50, 39, '居住'),
(51, 50, '移民'),
(52, 50, '购房'),
(53, 50, '搬家'),
(54, 50, '装修'),
(55, 39, '求学阶段'),
(56, 55, '初中及以下'),
(57, 55, '高中中专'),
(58, 55, '大专'),
(59, 55, '本科'),
(60, 55, '研究生及以上'),
(61, 39, '备考'),
(62, 61, '中考'),
(63, 61, '高考'),
(64, 61, '考研'),
(65, 61, '出国留学'),
(66, 0, '兴趣爱好'),
(67, 66, '享受'),
(68, 67, '奢侈品'),
(69, 67, '美食'),
(70, 67, '品酒'),
(71, 67, '旅游'),
(72, 67, '汽车'),
(73, 67, '其它'),
(74, 66, '娱乐'),
(75, 74, '名人明星'),
(76, 74, '音乐'),
(77, 74, '戏曲'),
(78, 74, '电影'),
(79, 74, '电视剧'),
(80, 74, '动漫'),
(81, 74, '综艺娱乐'),
(82, 74, '舞蹈'),
(83, 74, '相声小品'),
(84, 74, '摄影'),
(85, 74, '彩票'),
(86, 74, '棋牌桌游'),
(87, 74, '其他'),
(88, 66, 'IT数码'),
(89, 88, '手机数码'),
(90, 88, '电脑家电'),
(91, 88, 'IT技术'),
(92, 88, '科技信息'),
(93, 88, '其他'),
(94, 66, '时尚'),
(95, 94, '美容护理'),
(96, 94, '服饰配饰'),
(97, 94, '美体健身'),
(98, 94, '写真摄影'),
(99, 94, '其它'),
(100, 66, '生活与家庭'),
(101, 100, '亲子育宝'),
(102, 100, '健康养生'),
(103, 100, '家居'),
(104, 100, '居家风水'),
(105, 100, '家庭装饰'),
(106, 100, '花卉园艺'),
(107, 100, '宠物'),
(108, 100, '烹饪'),
(109, 100, '其他'),
(110, 66, '体育赛事'),
(111, 110, '足球'),
(112, 110, '篮球'),
(113, 110, '排球'),
(114, 110, '乒乓球'),
(115, 110, '网球'),
(116, 110, '羽毛球'),
(117, 110, '田径'),
(118, 110, '体操'),
(119, 110, '武术、气功、太极'),
(120, 110, '高尔夫、马术、赛车'),
(121, 110, '水上运动'),
(122, 110, '极限运动'),
(123, 110, '棋牌类运动'),
(124, 110, '其他'),
(125, 66, '金融财经'),
(126, 125, '理财'),
(127, 125, '房地产'),
(128, 125, '金融投资'),
(129, 125, '财政资讯'),
(130, 125, '项目投资'),
(131, 66, '社会'),
(132, 131, '社会政治'),
(133, 131, '军事'),
(134, 131, '其它'),
(135, 66, '网络行为'),
(136, 135, '网购'),
(137, 135, '社交'),
(139, 137, '社交网络'),
(140, 137, '婚恋交友'),
(141, 137, '商务'),
(142, 137, '休闲活动'),
(143, 137, '其他'),
(144, 135, '网络文学'),
(145, 144, '武侠仙侠'),
(146, 144, '玄幻奇幻'),
(147, 144, '都市爱情'),
(148, 144, '科幻超能'),
(149, 144, '惊悚悬疑'),
(150, 144, '军事历史'),
(151, 144, '游戏竞技'),
(152, 144, '其他'),
(153, 135, '精读'),
(154, 153, '专业技术'),
(155, 153, '管理'),
(156, 153, '励志'),
(157, 153, '人文艺术'),
(158, 153, '生活'),
(159, 153, '报刊杂志'),
(160, 153, '其他'),
(161, 135, '游戏'),
(162, 161, '类型'),
(163, 162, '大型客户端游戏'),
(164, 162, '手机平板游戏'),
(165, 162, '小游戏flash游戏'),
(166, 162, '即时战斗RPG页游'),
(167, 162, '回合制RPG页游'),
(168, 162, '战争策略类页游'),
(169, 162, '网游'),
(170, 162, '通用页游'),
(171, 161, '主题'),
(172, 171, '动作和平台游戏'),
(173, 171, '冒险游戏'),
(174, 171, '休闲游戏'),
(175, 171, '驾驶与赛车游戏'),
(176, 171, '格斗游戏'),
(177, 171, '音乐舞蹈游戏'),
(178, 171, '射击游戏'),
(179, 171, '模拟游戏'),
(180, 171, '体育游戏'),
(181, 171, '战略游戏'),
(182, 171, '游戏媒体与参考'),
(183, 161, '游戏/其他'),
(184, 0, '购买倾向'),
(185, 184, '保健'),
(186, 185, '保健品'),
(187, 185, '保健按摩器材'),
(188, 185, '健身设备'),
(189, 185, '健身产品及服务'),
(190, 185, '其他'),
(191, 184, '汽车'),
(192, 191, '档次'),
(193, 192, '高端品牌'),
(194, 192, '非高端品牌'),
(195, 191, '地区'),
(196, 195, '美洲'),
(197, 195, '欧洲'),
(198, 195, '日本'),
(199, 195, '韩国'),
(200, 195, '中国'),
(201, 191, '品牌'),
(202, 201, '宝马'),
(203, 201, '奔驰'),
(204, 201, '奥迪'),
(205, 201, '斯柯达'),
(206, 201, '福特'),
(207, 201, '别克'),
(208, 201, '雪佛兰'),
(209, 201, '大众'),
(210, 201, '雪铁龙'),
(211, 201, '标致'),
(212, 201, '路虎'),
(213, 201, '雪佛兰'),
(214, 201, '东风'),
(215, 201, '长安'),
(216, 201, '保时捷'),
(217, 201, '比亚迪'),
(218, 201, '吉利'),
(219, 201, 'jeep'),
(220, 201, '马自达'),
(221, 201, '日产'),
(222, 201, '本田'),
(223, 201, '丰田'),
(224, 201, '现代'),
(225, 201, '起亚'),
(226, 201, '奇瑞'),
(227, 191, '车型'),
(228, 227, '微型车'),
(229, 227, '小型车'),
(230, 227, '紧凑型车'),
(231, 227, '中型车'),
(232, 227, '中大型车'),
(233, 227, '豪华车'),
(234, 227, 'SUV'),
(235, 227, 'MPV'),
(236, 227, '跑车'),
(237, 191, '价位'),
(238, 237, '>40万'),
(239, 237, '15-40万'),
(240, 237, '<15万'),
(241, 191, '产地'),
(242, 241, '国产'),
(243, 241, '进口'),
(244, 191, '汽车配件与耗材'),
(245, 191, '汽车车险'),
(246, 191, '汽车用品'),
(247, 191, '其他'),
(248, 184, '金融财经'),
(249, 248, '股票'),
(250, 248, '基金'),
(251, 248, '期货'),
(252, 248, '外汇'),
(253, 248, '保险'),
(254, 248, '贷款'),
(255, 248, '银行理财'),
(256, 248, '贵金属'),
(257, 248, '收藏'),
(258, 248, '网贷投资'),
(259, 248, '余额理财'),
(260, 248, '其他'),
(261, 184, '旅游'),
(262, 261, '地域'),
(263, 262, '国内游-一线城市'),
(264, 262, '国内游-二线城市'),
(265, 262, '国内游-三线城市'),
(266, 262, '国内游-其他'),
(267, 262, '本地郊游'),
(268, 262, '出境游-欧美大洋洲'),
(269, 262, '出境游-非洲'),
(270, 262, '出境游-中亚'),
(271, 262, '出境游-东南亚'),
(272, 262, '出境游-日韩'),
(273, 262, '出境游-南亚'),
(274, 262, '出境游-南美'),
(275, 262, '自驾游'),
(276, 261, '目的'),
(277, 276, '户外探险'),
(278, 276, '商务旅行'),
(279, 276, '休闲度假'),
(280, 261, '方式'),
(281, 280, '航空'),
(282, 280, '铁路'),
(283, 280, '汽车'),
(284, 280, '邮轮'),
(285, 261, '酒店档次'),
(286, 285, '五档次酒店'),
(287, 285, '四星'),
(288, 285, '三星及以下'),
(289, 285, '精品/特色酒店'),
(290, 285, '经济型酒店'),
(291, 285, '青年旅舍'),
(292, 285, '民宿'),
(293, 261, '酒店价位'),
(294, 293, '高'),
(295, 293, '中'),
(296, 293, '低'),
(297, 261, '服务'),
(298, 297, '票务'),
(299, 297, '旅游公司'),
(300, 297, '签证服务'),
(301, 261, '旅游/其他'),
(302, 184, '教育培训'),
(303, 302, '学前教育'),
(304, 302, '学生课外辅导'),
(305, 302, '才艺兴趣'),
(306, 302, '留学出国'),
(307, 302, '管理/MBA培训'),
(308, 302, '外语培训'),
(309, 302, '考研辅导'),
(310, 302, '成考辅导'),
(311, 302, '自考辅导'),
(312, 302, '公务员考试培训'),
(313, 302, '事业单位考试培训'),
(314, 302, '职业技能培训'),
(315, 302, '其他'),
(316, 184, '电子游戏'),
(317, 316, '游戏装备'),
(318, 316, '游戏账号'),
(319, 316, '游戏代练'),
(320, 316, '游戏设备'),
(321, 316, '其他'),
(322, 316, '游戏币'),
(323, 184, '运动产品'),
(324, 323, '户外用品'),
(325, 323, '健身用品'),
(326, 323, '球类用品'),
(327, 323, '其他'),
(328, 184, '数码产品'),
(329, 328, '电脑'),
(330, 328, '电脑周边'),
(331, 328, '手机及平板'),
(332, 328, '网络设备'),
(333, 328, '移动存储'),
(334, 328, '办公设备'),
(335, 328, '摄像摄影器材'),
(336, 328, '数码摄像机'),
(337, 328, '游戏系统与游戏机'),
(338, 328, '电视及视频设备'),
(339, 328, '半导体及零配件'),
(340, 328, '软件及服务'),
(341, 328, '其他'),
(342, 184, '家电'),
(343, 342, '家庭娱乐'),
(344, 342, '厨房电器'),
(345, 342, '家用电器'),
(346, 342, '个护电器'),
(347, 342, '大家电'),
(348, 342, '家电周边'),
(349, 342, '其他'),
(350, 184, '鞋服包饰'),
(351, 350, '男装'),
(352, 350, '女装'),
(353, 350, '运动休闲'),
(354, 350, '童装'),
(355, 350, '内衣'),
(356, 350, '服饰配件'),
(357, 350, '男鞋'),
(358, 350, '女鞋'),
(359, 350, '童鞋'),
(360, 350, '运动鞋'),
(361, 350, '箱包'),
(362, 350, '其他'),
(363, 184, '个护美容'),
(364, 363, '面部护理'),
(365, 363, '身体护理'),
(366, 363, '缤纷彩妆'),
(367, 363, '香水香氛'),
(368, 363, '男士专区'),
(369, 363, '美容工具'),
(370, 363, '美发护发'),
(371, 363, '口腔护理'),
(372, 363, '其他'),
(373, 184, '家居家装'),
(374, 373, '家纺'),
(375, 373, '家具'),
(376, 373, '家装'),
(377, 373, '厨具餐具'),
(378, 373, '其他'),
(379, 184, '生活日用'),
(380, 379, '储物收纳'),
(381, 379, '家务清洁'),
(382, 379, '居家杂件'),
(383, 379, '日化用品'),
(384, 379, '其他'),
(385, 184, '母婴'),
(386, 385, '婴幼儿'),
(387, 385, '孕妈'),
(388, 385, '其他'),
(389, 184, '奢侈品'),
(390, 389, '腕表'),
(391, 389, '珠宝'),
(392, 389, '化妆品'),
(393, 389, '服装服饰'),
(394, 389, '箱包'),
(395, 389, '名酒'),
(396, 389, '鞋靴'),
(397, 389, '奢品小件'),
(398, 389, '其他'),
(399, 185, '房地产'),
(400, 399, '别墅'),
(401, 399, '公寓'),
(402, 399, '商业房产'),
(403, 399, '普通住宅'),
(404, 399, '其他'),
(405, 0, '性别'),
(406, 405, '全部'),
(407, 405, '男'),
(408, 405, '女');

FINE;
        $this->execute($sql);
    }

    public function down()
    {
        return $this->dropTable('{{%audience_type}}');
    }
}
